package blue.blog.core.dao;

import org.springframework.stereotype.Repository;

import com.blue.jdbc.BaseDao;

import blue.blog.core.model.CmsChannel;

@Repository
public class CmsChannelDao extends BaseDao<CmsChannel>
{
	public CmsChannelDao()
	{
	}

	@Override
	protected void query(StringBuilder sql, CmsChannel param)
	{
		if (param != null)
		{
			if (param.getState() != null && param.getState() != -1)
				sql.append(" and a.state=:state");
		}
	}
	
	public int incDocs(Integer id, Integer docs)
	{
		String sql = "update cms_channel set docs=docs+? where id=?";
		return jdbcTemplate.update(sql, docs, id);
	}

}
